<!--

/**
* editUser.html: form to edit a user or create new user. Utilized as pop-up from manageGroups and manageUsers
*
* @package     Heurist academic knowledge management system
* @link        http://HeuristNetwork.org
* @copyright   (C) 2005-2014 University of Sydney
* @author      Artem Osmakov   <artem.osmakov@sydney.edu.au>
* @author      Ian Johnson     <ian.johnson@sydney.edu.au>
* @author      Tom Murtagh, Kim Jackson, Stephen White
* @author      Ian Johnson   <ian.johnson@sydney.edu.au>
* @license     http://www.gnu.org/licenses/gpl-3.0.txt GNU License 3.0
* @version     3.2
*/

/*
* Licensed under the GNU License, Version 3.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at http://www.gnu.org/licenses/gpl-3.0.txt
* Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied
* See the License for the specific language governing permissions and limitations under the License.
*/

-->

<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8">
        <title></title>

        <link rel="stylesheet" type="text/css" href="../../common/css/global.css">
        <link rel="stylesheet" type="text/css" href="../../common/css/edit.css">
        <link rel="stylesheet" type="text/css" href="../../common/css/admin.css">

        <!-- YUI -->
        <link rel="stylesheet" type="text/css" href="../../external/yui/2.8.2r1/build/fonts/fonts-min.css" />
        <script type="text/javascript" src="../../external/yui/2.8.2r1/build/yahoo-dom-event/yahoo-dom-event.js"></script>
        <script type="text/javascript" src="../../external/yui/2.8.2r1/build/element/element-min.js"></script>
        <script type="text/javascript" src="../../external/yui/2.8.2r1/build/json/json-min.js"></script>

        <script type="text/javascript" src="../../external/jquery/jquery.js"></script>
    </head>

    <body class="popup" width="680" height="600">
        <script type="text/javascript" src="../../common/js/utilsLoad.js"></script>
        <script type="text/javascript" src="../../common/js/utilsUI.js"></script>
        <script src="../../common/php/displayPreferences.php"></script>
        <script src="loadUserInfoShort.php"></script>
        <script type="text/javascript" src="../../admin/ugrps/editUser.js"></script>

        <script type="text/javascript">
            if(Hul.isnull(top.HEURIST)) { top.HEURIST = {}; }

            var _db = (top.HEURIST.parameters.db? top.HEURIST.parameters.db :
                (top.HEURIST.database.name?top.HEURIST.database.name:''));
            var _url = top.HEURIST.basePath +'admin/ugrps/loadUserGrps.php?method=getuser&db='+_db;

            top.HEURIST.parameters = top.HEURIST.parseParams(location.search);
            var _recID = top.HEURIST.parameters.recID;

            if(Hul.isnull(_recID)) { _recID = 0; }
            _url = _url + "&recID="+_recID;

            Hul.loadScript2(this.document, _url);
        </script>

        <div id="statusMsg"></div>

        <div id="detailTypeValues" style="padding:5px;">
            <div id="div-inpit-ugr_ID" class="input-row">
                <div class="input-header-cell" for="ugr_ID">User ID</div>
                <div class="input-cell" id="ugr_ID"></div>
            </div>

            <div class="input-row required">
                <div class="input-header-cell" for="ugr_FirstName">Given name</div>
                <div class="input-cell"><input id="ugr_FirstName" style="width:50;" maxlength="40" /></div>
            </div>

            <div class="input-row required">
                <div class="input-header-cell" for="ugr_LastName">Family name</div>
                <div class="input-cell"><input id="ugr_LastName" style="width:50;" maxlength="63" /></div>
            </div>

            <div class="input-row required">
                <div class="input-header-cell" for="ugr_eMail">Email</div>
                <div class="input-cell">
                    <input id="ugr_eMail" style="width:200;" maxlength="100" onKeyUp="document.getElementById('ugr_Name').value=this.value;"/></div>
            </div>

            <div class="input-row required">
                <div class="input-header-cell" for="ugr_Name">Login name</div>
                <div class="input-cell"><input id="ugr_Name" style="width:200;" maxlength="63" />
                    <div class="help prompt">
                        The login field is auto-populated with your email address. <br />
                        You may change it to a shorter version, such as your given name or family name
                    </div>
                </div>
            </div>

            <div class="input-row required">
                <div class="input-header-cell" for="ugr_Password">Password</div>
                <div class="input-cell">
                    <input id="ugr_Password" type="password" style="width:50;" maxlength="40" />&nbsp;If editing, leave blank for no change
                    <div class="help prompt" style="color:red;">
                        Note: http:// web traffic is non-encrypted. You should not assume this server is secure.<br />
                        Therefore, please don't use an important password such as institutional or banking login.<br />
                        If you need to store data of a confidential nature, such as personal records, please<br />
                        contact the Heurist team or your system administrator about setting up a secured server.
                    </div>
                </div>
            </div>

            <div class="input-row required">
                <div class="input-header-cell" for="ugr_Password2">Repeat password</div>
                <div class="input-cell"><input id="ugr_Password2" type="password" style="width:50;" maxlength="40" />
                </div>
            </div>

            <div class="input-row required">
                <div class="input-header-cell" for="ugr_Organisation">Institution/company</div>
                <div class="input-cell"><input id="ugr_Organisation" style="width:200;" maxlength="120" />
                    <div class="help prompt">
                        Enter 'None' if not affiliated with an institution or company
                    </div>
                </div>
            </div>

            <div class="input-row required">
                <div class="input-header-cell"  style="vertical-align:top" for="ugr_Interests">Research Interests</div>
                <div class="input-cell"><textarea id="ugr_Interests" rows="2" style="width:420;" maxlength="255"></textarea>
                    <div class="help prompt">
                        Enter a concise description (up to 250 characters) of your research interests
                    </div>
                </div>
            </div>

            <div id="div-inpit-ugr_Enabled" class="input-row">
                <div class="input-header-cell" for="ugr_Enabled">Enabled:</div>
                <div class="input-cell"><input id="ugr_Enabled" type="checkbox"/>
                    <div class="help prompt">
                        Check to enable the user, unchecked users will not be able to log in
                    </div>
                </div>
            </div>

            <div id="div-inpit-ugr_IsModelUser" class="input-row"  style="display: none;">
                <div class="input-header-cell" for="ugr_IsModelUser">Model user</div>
                <div class="input-cell"><input id="ugr_IsModelUser" type="checkbox"/>
                    <div class="help prompt">
                        If checked, user's tags, searches and bookmarks will appear in My Profile &gt; Load Profiles
                    </div>
                </div>
            </div>

            <!-- OPTIONAL FIELDS -->
            <div id="optional" class="togglepnl" style="margin-top:15px;">
                <a onMouseDown="$('#options').slideToggle('fast'); $('#optional').toggleClass('show'); $('#options').toggleClass('hidden');"
                    style="margin-left: 50px;">Optional information</a>
                <div id="options" class="hidden" style="background-color:#ffffff;">

                    <div class="input-row">
                        <div class="input-header-cell" style="vertical-align:top" for="ugr_IncomingEmailAddresses">Incoming email addresses</div>
                        <div class="input-cell"><textarea cols="200" id="ugr_IncomingEmailAddresses" rows="2" style="width:420;"></textarea>
                            <div class="help prompt">
                                Comma-separated list of email addresses you may use to send email to the database
                                Email sent from these addresses may be harvested into database records
                            </div>
                        </div>
                    </div>

                    <div class="input-row">
                        <div class="input-header-cell" style="vertical-align:top" for="ugr_TargetEmailAddresses">Outgoing email addresses</div>
                        <div class="input-cell"><textarea cols="200" id="ugr_TargetEmailAddresses" rows="2" style="width:420;"></textarea>
                            <div class="help prompt">
                                Comma-separated list of email addresses to which you may want to send database records as email.
                                This will be added to the default list for the database when choosing an email destination to which to email records.
                            </div>
                        </div>
                    </div>

                    <div class="input-row">
                        <div class="input-header-cell">Department</div>
                        <div class="input-cell"><input id="ugr_Department" style="width:200;" maxlength="120" /></div>
                    </div>
                    <div class="input-row">
                        <div class="input-header-cell" for="ugr_City">Suburb/City</div>
                        <div class="input-cell"><input id="ugr_City" style="width:100;" maxlength="63" /></div>
                    </div>
                    <div class="input-row">
                        <div class="input-header-cell">State</div>
                        <div class="input-cell"><input id="ugr_State" style="width:50;" maxlength="40" /></div>
                    </div>
                    <div class="input-row">
                        <div class="input-header-cell">Zip/postcode</div>
                        <div class="input-cell"><input id="ugr_Postcode" style="width:50;" maxlength="20" /></div>
                    </div>


                    <!-- This field is really intended more for user groups-->
                    <div class="input-row" style="display: none;">
                        <div class="input-header-cell" style="vertical-align:top" for="ugr_Description">Description</div>
                        <div class="input-cell"><textarea cols="200" id="ugr_Description" rows="4" style="width:420;"></textarea>
                            <div class="help prompt">
                                Description of a workgroup, used in workgroup homepage
                            </div>
                        </div>
                    </div>

                    <div class="input-row">
                        <div class="input-header-cell" style="vertical-align:top" for="ugr_URLs">Personal Website URLs</div>
                        <div class="input-cell"><textarea cols="200" id="ugr_URLs" rows="1" style="width:420;"></textarea></div>
                    </div>

                    <!-- TODO: THESE FIELDS NEED TO BE ACCESSIBLE ONLY TO DATABASE ADMINS -->

                </div> <!-- optional div -->
            </div>

            <div style="padding-top: 5px">&nbsp;</div>

            <div id="condition" class="togglepnl hidden" style="margin-left: 50px;">
                <a onMouseDown="$('#options2').slideToggle('fast'); $('#condition').toggleClass('show'); $('#options2').toggleClass('hidden');">
                    Conditions of Use</a>
                <div id="options2" class="hidden" style="background-color:#ffffff;">
                    <br />
                    <div>HEURIST is a development system maintained by the University of Sydney, and our funding is modest.
                        By using the HEURIST system on a University of Sydney server you acknowledge the following and agree
                        to license these systems on the following terms and conditions. Different conditions may be applied on
                        servers maintained by other institutions or individuals - please consult those concerned:</div>
                    <ul>
                        <li>
                            HEURIST services on University of Sydney servers are intended for personal and academic use only.
                            All users are specifically identified by their name, email address and
                            institution. This is required to provide a focus and accountability and to
                            avoid the problems associated with anonymous systems.
                        </li>
                        <li>
                            As a user you agree not to enter any material which members of the
                            general public would reasonably consider to be offensive. You agree only
                            to enter material in which you hold copyright and any other relevant
                            intellectual property rights, and in entering material you agree to make
                            it available for fair use by the University of Sydney and by other users
                            of the system. You further agree to indemnify the University of Sydney for
                            any claims arising from any breach by you of these terms and conditions.
                        </li>
                        <li>As a user you also agree not to enter any material of a personal nature such as
                            survey or health data identifying individuals without the express written permission
                            of the system managers. Confidential data of this type will require special
                            precautions to ensure its security.
                        </li>
                        <li>
                            We will use reasonable efforts to maintain the operation, reliability
                            and security of the systems, to provide means of exporting information
                            from the system in a structured form suitable for import to other systems,
                            and to give adequate warning if for any reason our support of the systems
                            is to be reduced or discontinued. However, you agree that we provide no
                            express or implied warranties in relation to the operation, reliability or
                            security of the systems or otherwise, nor in relation to the content of any
                            material available on the systems. You agree that any use of the systems
                            is made entirely at your own risk. You expressly release us from any and
                            all liability arising from or in any way connected with your use of the
                            systems.
                        </li>
                        <li>
                            In the first instance we make the system available to any
                            academics and selected others in our absolute discretion. We may at some time
                            need to limit new registrations and/or access if usage of the systems
                            exceeds our ability to service traffic.
                        </li>
                        <li>
                            We reserve the right to block/remove any users who we determine in our
                            absolute discretion abuse the system or enter inappropriate content,
                            without recourse and without explanation.
                        </li>
                        <li>
                            Other authorised/logged-in users of a specific database are able to view the
                            contact details of persons who added, edited or tagged records in the database.
                            By using these systems you agree that your contact details will be made available
                            to other users in this manner.
                        </li>
                        <li>
                            Other authorised/logged-in users of a specific database can view and search across
                            all tags you use within that database, and may be able to search across all text
                            you have entered, in order to identify records of interest, however other users
                            cannot view text marked as private (private notes, password reminders etc.).
                        </li>
                    </ul>

                </div> <!-- optional div -->
            </div>
        </div>

        <br/>

        <div>
            <div id="regInfo" class="hidden">
                <p>Please read the Conditions of Use above, then click the Register button at the end of the page.
                Note: This system should not be used for the storage of confidential personally-identifiable information
                such as health information without the express permission of the system managers.</p>
                <p>If you experience problems with the registration process,
                    please let us know what went wrong (and send your registration details for manual addition).</p>
                <p id="contactDetails"> (database owner)</p>
                <input type="checkbox" name="agree" onClick="e=getElementById('register_button'); if (e) e.disabled=!this.checked;">
                I have read and agree to the Terms and Conditions of Use above<br>
            </div>

            <div id="regButtons" class="actionButtons hidden" style="margin-bottom:20px">
                <input type="button" value="Register" id="register_button" disabled="disabled" onClick="window.userEditor.save();" />  &nbsp;&nbsp;&nbsp;
                <input type="button" value="Close" onClick="window.close(null);" />
            </div>

        </div>

        <div id="editButtons" class="actionButtons" style="margin-bottom:20px">
            <span id="btn_approve" style="display: none; width:240px; text-align: left;">
                <input type="button" value="APPROVE" style="color:red; font-size:12px;" onClick="window.userEditor.save();" />
            </span>
            <span id="btn_edits">
                <input type="button" value="Save" onClick="window.userEditor.save();" />  &nbsp;&nbsp;&nbsp;
                <input type="button" value="Cancel" onClick="window.userEditor.cancel();" /> &nbsp;&nbsp;&nbsp;
            </span>
            <span id="btn_view" style="display: none;">
                <input type="button" value="Close" onClick="window.close(null);" />
            </span>
            <br>&nbsp;<br>
        </div>

        <script type="text/javascript">

            var userEditor;

            //
            //  starts initialization on load completion of this window
            //
            function loadHandler(){
                window.userEditor = new UserEditor();
            }
            YAHOO.util.Event.addListener(window, "load", loadHandler );
            //function(){userEditor = new GroupEditor();} );
            //to implment window.onbeforeunload = onbeforeunload;

        </script>


    </body>
</html>